package com.ssm.xml.controller;

import com.alibaba.fastjson.JSON;
import com.ssm.xml.service.UserService;
import com.ssm.xml.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张富玮
 * @create 2022-01-28 19:58
 */
@RestController
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/")
    public String index() {
        return "index";
    }

    @RequestMapping("/getAllUser")
    public String getAllUsers() {
        return JSON.toJSONString(userService.getAllUsers());
    }

    @RequestMapping("/login")
    public String login(String account,String password){
        boolean res=userService.login(account,password);
        return String.valueOf(res);
    }
}
